package com.jia.controller;

import com.jia.mapper.UserMapper;
import com.jia.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    UserMapper userMapper;

    @RequestMapping("/list")
    public List<User> list() {
        List<User> users = userMapper.selectUsers();
        return users;
    }

    @RequestMapping("info/{id}")
    public User info(@PathVariable int id){
        return userMapper.selectUserById(id);
    }

}
